package task3

class Human implements Serializable {
    String name
    String position
    Integer age
    String gender
    Float salary
    Date dateHired
    String humanEmail

    static belongsTo = [project: Project]

    static constraints = {
        name(size: 3..20, blank: false, unique: 'project')
        position(size: 3..20, blank: false)
        salary(nullable: true)
        age(nullable: true, min: 18, max: 99 /*validator: {age -> return ((age>18 && age<99)||age==null)}*/ )
        gender(nullable: true)
        humanEmail(email: true, nullable: true)
        dateHired(nullable: true)
    }

    String toString(){
        "${name} (${position})"
    }


}
